package com.platform.admin.controller;

import com.platform.utils.ShiroUtils;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

/**
 * 系统页面视图Controller
 *
 * @author lipengjun
 * @email 939961241@qq.com
 * @gitee https://gitee.com/fuyang_lipengjun/platform
 * @date 2016年11月24日 下午11:05:27
 */
@Controller
public class SysPageController {

    /**
     * 视图路径
     *
     * @param module 模块
     * @param url    url
     * @return 页面视图路径
     */
    @RequestMapping("{module}/{url}.html")
    public ModelAndView page(@PathVariable("module") String module, @PathVariable("url") String url) {
        ModelAndView view = new ModelAndView(module + "/" + url);
        return view;
    }

    @RequestMapping({"/"})
    public String index() {
        String next = "redirect:/login.html";
        if (ShiroUtils.isLogin()) {
            next = "redirect:/index.html";
        }
        return next;
    }

}
